ITK Programmer's Guide |
|||||||||
Table of contents |
Intro | General
| TCP Low Level |
TCP High Level |
UDP | DNS
| PPP
|
Filtering flags can help you apply filters on the data you send or receive. This encoding is possible when using the following functions: ITK_ TCPSend, ITK_TCPRcv, ITK_TCPSendFile, ITK_TCPRcvFile, ITK_TCPSendBlob, ITK_TCPRcvBlob.
You can use one or more filter by adding the following constants
(ex: Mac->ISO + CR->CR/LF = 1 + 4 = 5).
Filters are applied in the list order.
1 |
convert Mac text to ISO 8859-1 (see ITK_Text2ISO) |
2 |
convert ISO 8859-1 to Mac text (see ITK_ISO2Text) |
4 |
convert CR to CR/LF |
8 |
convert CR/LF to CR |
16 |
convert Mac text to HTML, same as ITK_Text2HTML(text;0) |
32 |
convert HTML to Mac text (see ITK_HTML2Text) |
|
convert Mac 8bit text only to HTML, same as ITK_Text2HTML(text;1) |
|
convert Mac text to Base64 (see ITK_Text2B64) |
|
convert Base64 to Mac text (see ITK_B642Text) |
|
convert Mac text to Quoted-Printable (see ITK_Text2Quoted) |
|
convert Quoted-Printable to Mac text (see ITK_Quoted2Text) |
Each TCP stream can be in a particular state at a given time. To each state corresponds a specific value in the following table.
To obtain the status for a given stream you can use ITK_TCPStatus. To wait for a given status on a given stream, you can either have a loop repeatedly calling ITK_TCPStatus or use ITK_TCPWaitConn.
0 |
Closed |
no connection exists on this stream |
2 |
Listen |
listening for an incoming connection. |
4 |
SYN received |
incoming connection is being established |
6 |
SYN sent |
outgoing connection is being established |
8 |
Established |
connection is up |
10 |
FIN Wait 1 |
connection is up; close has been issued |
12 |
FIN Wait 2 |
connection is up; close has been completed |
14 |
Close Wait |
connection is up; close has been received |
16 |
Closing |
connection is up; close has been issued and received |
18 |
Last ACK |
connection is up; close has been issued and received |
20 |
Time Wait |
connection is being broken |
Status 8 and 14 are the most commonly checked.
A status value of 8 means that the connexion is fully established and
that data can be exchanged between to 2 extremities.
A status value of 14 means that the other side has acknowledge the
request to close the connexion (end of HTTP request, for
example).
The status value of a given stream can only increase over time,
except if an error occurs, in which case a negative value will be
returned as described in table 3.
This table list the error codes that can be returned by MacTCP and their corresponding meanings.
-1 |
badStreamRef |
The stream ref is unknown or generic error. |
-23000 |
ipBadLapErr |
Unable to initialise the local network handler |
-23001 |
ipBadCnfgErr |
The manually set address is configured improperly |
-23002 |
ipNoCnfgErr |
A configuration resource is missing. |
-23003 |
ipLoadErr |
Not enough room in the application heap (Macintosh 512K enhanced only). |
-23004 |
ipBadAddr |
Error in getting an address from a server or the address is already in use by another machine. |
-23005 |
connectionClosing |
A TCPClose command was already issued so there is no more data to send on this connection. |
-23006 |
invalidLength |
The total amount of data described by the WDS was either 0 or greater than 65,535 bytes. |
-23007 |
connectionExists |
The TCP or UDP stream already has an open connection. |
-23008 |
connectionDoesntExist |
This TCP stream has no open connection. |
-23009 |
insufficientResources |
64 TCP or UDP streams are already open. |
-23010 |
invalidStreamPtr |
The specified TCP or UDP stream is not open. |
-23011 |
streamAlreadyOpen |
An open stream is already using this receive buffer area. |
-23012 |
connectionTerminated |
The TCP connection was broken; the reason will be given in a terminate ASR. |
-23013 |
invalidBufPtr |
The receive buffer area pointer is 0. |
-23014 |
invalidRDS or |
The RDS refers to receive buffers not owned by the use,
OR |
-23015 |
openFailed |
The connection came halfway up and then failed. |
-23016 |
commandTimeout |
The specified command action was not completed in the specified time period. |
-23017 |
duplicateSocket |
A stream is already open using this local UDP port or a TCP connection already exists between this local IP address and TCP port, and the specified remote IP address and TCP port. |
-23032 |
ipDontFragErr |
The packet is too large to send without fragmenting and the Don't Fragment flag is set. |
-23033 |
ipDestDeadErr |
The destination host is not responding to address resolution requests. |
-23035 |
icmpEchoTimeoutErr |
The icmp echo packet was not responded to in the indicated timeout period. |
-23036 |
ipNoFragMemErr |
Insufficient internal driver buffers available to fragment this packet on send. |
-23037 |
ipRouteErr |
No gateway available to manage routing of packets to off-network destinations. |
-23041 |
nameSyntaxErr |
The hostName field had a syntax error. The address was given in dot notation (that is, W.X.Y.Z) and did not conform to the syntax for an IP address. |
-23042 |
cacheFault |
The name specified cannot be found in the cache. The domain name resolver will now query the domain name server and return the answer in the call-back procedure. |
-23043 |
noResultProc |
No result procedure is passed to the address translation call when the resolver must be used to find the address. |
-23044 |
noNameServer |
No name server can be found for the specified name string. |
-23045 |
authNameErr |
This domain name does not exist. |
-23046 |
noAnsErr |
None of the known name servers are responding. |
-23047 |
dnrErr |
The domain name server has returned an error. |
-23048 |
outOfMemory |
Not enough memory is available to issue the needed DNR query or to build the DNR cache. |
See also on Yahoo.